<template>
	<view class="">
		<uni-section title="直达基层列表" titleFontSize="35rpx" type="line">
			<uni-list>
				<uni-list-item v-for="(item,index) in rwList" :key="index" :title="item.sxbt" :note="item.xdrq"
					showArrow thumb="/static/logo.png" thumb-size="lg"
					rightText="查看" ellipsis="2" :to="`./ckRwxx?sid=` + item.sid" @click="onClick" />
			</uni-list>
			<!-- thumb="../../static/images/task.png" -->
<!--			<template v-slot:right>-->
<!--				<view class="action-btn">-->
<!--					<button style="margin-right: 20rpx;" @click="toAdd" class="login-btn cu-btn  bg-blue">去新增</button>-->
<!--					&lt;!&ndash; <button @click="exitApp()" class="login-btn cu-btn  uni-success">退出</button> &ndash;&gt;-->
<!--				</view>-->
<!--			</template>-->
		</uni-section>
		<uni-load-more color="#007AFF" :status="status" />
	</view>
</template>

<script>
	import {	getAppRwPage	} from "@/api/system/xdwj";
	import {	getUsername	} from '@/utils/auth';

	export default {
		name: "issuanceByStep",
		data() {
			return {
				rwList: [],
				status: 'more',
				pageParams: {
          isCq:'',
          myMatter:'',
          sxlx:'',
					username: '',
					total: 0,
					page: 1,
					limit: 10,
				}
			};
		},
		onPullDownRefresh() {
			console.log('refresh');
			this.getList()
		},
		onLoad(options) {
      if (options.isCq){
        this.pageParams.isCq = options.isCq;
      }
      if (options.myMatter){
        this.pageParams.myMatter = options.myMatter;
      }
      if (options.sxlx){
        this.pageParams.sxlx = options.sxlx;
      }
			this.pageParams.username = getUsername();
		},
		onShow() {
			this.getList()
		},
		onReachBottom() {
			if ('no-more' === this.status) return;
			this.status = 'loading'
			this.addList();
		},
		methods: {
			getList() {
				this.pageParams.page = 1;
				this.status = 'more';
				getAppRwPage(this.pageParams).then(res => {
					if (res.rows.length < this.pageParams.limit) {
						this.status = 'no-more'
					}
					this.rwList = res.rows;
				})
				uni.stopPullDownRefresh();
			},
			addList() {
				this.pageParams.page++;
				getAppRwPage(this.pageParams).then(res => {
					if (res.rows.length < this.pageParams.limit) {
						this.status = 'no-more'
					}
					this.rwList = [...this.rwList, ...res.rows];
				})
			},
			onClick(e) {},
			toAdd() {
				this.$tab.navigateTo("/pages/home/through/issuanceAdd");
			}

		}
	}
</script>

<style>
	page {
		background-color: #f5f6f7;
	}
</style>
